package ynu.edu.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import ynu.edu.entity.Business;
import ynu.edu.repository.BusinessRepository;

import java.util.List;

@Service
public class BusinessService {

    @Autowired
    private BusinessRepository businessRepository;

    public Business getBusinessById(Integer businessId) {
        return businessRepository.findById(businessId)
                .orElseThrow(() -> new RuntimeException("商家不存在"));
    }

    public List<Business> listBusinessByOrderTypeId(Integer orderTypeId) {
        return businessRepository.findByOrderTypeId(orderTypeId);
    }
} 